<template>
  <div class="photoWraper">
    <div class="photoItem" v-for="(item, index) in imgsUrl" :key="index" @click="upDetailShow()">
      <img :src="item" alt="photo">
      <div class="imgCover">
        <div class="like">
          <span class="iconfont icon-xiai"></span>
          <i>12</i>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { storeToRefs } from 'pinia';

import { imgsUrl } from '../assets/data/wall'
import { photo } from '../mock/index'
import { useMainStore } from '../store';

const mainStore = useMainStore()
const { detailPopupsShow } = storeToRefs(mainStore)
const { upDetailPopups } = mainStore

// 详情弹窗显示与隐藏
const upDetailShow = (): void => {
  upDetailPopups()
}


</script>

<style lang="scss" scoped>
.photoWraper {
  width: 96%;
  border: 1px solid orange;
  position: relative;
  margin: 0 auto;
  margin-top: 20px;
  margin-bottom: 20px;
  columns: 6;
  column-gap: 10px;
  column-count: 10px;
  break-inside: avoid;

  .photoItem {
    width: 240px;
    height: 260px;
    position: relative;
    cursor: pointer;
    margin-bottom: 10px;
    break-inside: avoid;

    &:hover .imgCover {
      visibility: visible;
    }

    img {
      width: 100%;
      height: 100%;
    }

    .imgCover {
      width: 100%;
      height: 100%;
      background-color: rgba(155, 155, 155, .4);
      position: absolute;
      top: 0;
      left: 0;
      visibility: hidden;

      .like {
        width: 50%;
        border: 1px solid orange;
        border-radius: 10px;
        box-sizing: border-box;
        padding: 5px;
        margin: 5px 0 0 5px;
        background-color: rgba(255, 255, 255, 0.6);

        .iconfont {
          color: rgb(151, 151, 151);
          cursor: pointer;

          &:hover {
            color: red;
          }
        }
      }
    }
  }
}
</style>